package lesson03.TCP;

import java.io.IOException;
import java.net.Socket;

public class TCPSthreadServer01 extends TCPEchoServer01 {

    public TCPSthreadServer01(int port) throws IOException {
        super(port);
    }

    @Override
    public void start() throws IOException {
        System.out.println("服务器已启动，等待客户端连接.");
        while (true){
            Socket Clinetsocket = socket.accept();
            Thread thread = new Thread(() -> {
                processConnection(Clinetsocket);
            });
            thread.start();
        }
    }

    public static void main(String[] args) throws IOException {
        TCPSthreadServer01 tcpSthreadServer01 = new TCPSthreadServer01(9090);
        tcpSthreadServer01.start();
    }
}
